package com.bestv.bsr.core.constants;

import org.apache.commons.lang3.StringUtils;

/**
 * @author taojiacheng
 */
public interface CacheConstants {

    String SYMBOL_SPOT = ".";

    String ENABLED_AI_SOURCES = "bsr_enabled_aiSources";

    /**
     * sceneId:userAccount:itemType:itemCode
     */
    String HB_CACHE = "hb:data:%s:%s:%s:%s";

    String JT_BACK_UP = "jt:bk:%s:%s";

    String AH_DEFAULT = "ah:default:%s:%s";

    /**
     * 长征 安徽移动cacheKey
     * bsr:data:{推荐数据来源}:{推荐方法}:{场景id}:{节目类型}:{UserId}:{节目code}
     * bsr:data:{推荐数据来源}:{channel}:{catename}:{videoid}:{partnerUserId}:{deviceid}
     */
    String AH_CACHE_TEMPLATE = "bsr:data:%s:%s:%s:%s:%s:%s";


    static String format(String template, String... args) {
        for (int i = 0; i < args.length; i++) {
            if (StringUtils.isEmpty(args[i])) {
                args[i] = SYMBOL_SPOT;
            }
        }
        return String.format(template, (Object) args);
    }

}
